<!-- home -->
<template>
  <div class="container">

    <van-nav-bar
      title="业绩审核"
      class="navclass"
      left-arrow
      left-text="返回"
      @click-left="goback"
    />

    <van-cell title="审核人：" v-model="ywyname" />

    <van-cell title="选择缴费日期" required v-model="date" @click="onDisplay" is-link />

    <van-field
      v-model="shareas"
      label="商户区域:"
      required
      placeholder="请输入"
    />

    <van-field
      v-model="shname"
      label="商户名称:"
      required
      placeholder="请输入"
    />
    <van-field
      v-model="shphone"
      label="注册电话:"
      required
      placeholder="请输入老板注册电话"
    />

    <van-calendar v-model="dateshow" @close="onClose" @confirm="onConfirm" :show-confirm="kjflag"  :min-date="minDate" :default-date="currentDate"	/>

    <van-cell  title="选择业务类型" required title-class="titleclass"   v-model="ywlxname" center is-link @click="showFblx" />

    <van-cell  title="选择开通类型" required title-class="titleclass"   v-model="ktlxname" center is-link @click="showKtlx" v-if="ktlxxsshow"/>

    <van-cell  title="选择端口类型" required title-class="titleclass"   v-model="dklxname" center is-link @click="showDklx" v-if="dklxxsshow"/>

    <van-field
      v-model="dknum"
      :label="ywlx != '5' && ywlx != '6' && ywlx != '7' ? '端口数量:':'数量:'"
      required
      placeholder="请输入端口数量"
      type="number"
    />

    <van-field
      v-model="dyjzsnum"
      label-width="35%"
      label="打印机赠送数量:"
      placeholder="请输入数量"
      type="number"
      required
      v-if="dyjzsShow == true "
    />

    <van-field
      v-model="dybzsnum"
      label-width="35%"
      label="打印包赠送数量:"
      placeholder="请输入"
      type="number"
      required
      v-if="dybzsShow == true "
    />

    <van-cell title="打印纸赠送数量(箱)" title-width="50%" required  v-if="dyzzsShow == true " label="50卷为0.25箱" label-class="labelcss">
      <van-stepper
        v-model="dyzzsnum"
        default-value="0"
        step="0.25"
        :decimal-length="2"
        min="0"

      />
    </van-cell>

    <van-field
      v-model="znxysnum"
      label-width="60%"
      label="转年限已收端口金额（元）:"
      placeholder="请输入"
      type="number"
      required
      v-if="znxysShow == true "
    />

    <van-field
      v-model="znxysdyjnum"
      label-width="60%"
      label="转年限已收打印机金额（元）:"
      placeholder="请输入"
      type="number"
      required
      v-if="znxysdyjShow == true "
    />

    <van-cell title="是否购买打印机：" title-style="width:30%;" required v-if="ywlx != '5' ">
      <van-radio-group v-model="dyjgmflag" direction="horizontal" @change="onChangeDyjgmflag">
        <van-radio name="1">是</van-radio>
        <van-radio name="0">否</van-radio>
      </van-radio-group>
    </van-cell>

    <van-cell title="打印机类型：" title-style="width:30%;" required v-if="dyjgmflag == '1' || ywlx == '5' ">
      <van-radio-group v-model="dyjlx" direction="horizontal">
        <van-radio name="1">58</van-radio>
        <van-radio name="2">80</van-radio>
      </van-radio-group>
    </van-cell>

    <van-field
      v-model="dyjgmnum"
      label-width="35%"
      label="打印机购买数量:"
      placeholder="请输入"
      type="number"
      required
      v-if="dyjgmflag == '1' "
    />

    <van-field
      v-model="dyjgmje"
      label-width="35%"
      label="打印机购买金额:"
      placeholder="请输入"
      type="number"
      required
      v-if="dyjgmflag == '1' "
    />

    <van-cell title="是否购买打印包：" title-style="width:30%;" required v-if="ywlx != '6' ">
      <van-radio-group v-model="dybgmflag" direction="horizontal" @change="onChangeDybgmflag">
        <van-radio name="1">是</van-radio>
        <van-radio name="0">否</van-radio>
      </van-radio-group>
    </van-cell>

    <van-cell title="打印包类型：" title-style="width:30%;" required v-if="dybTypeShow == true || dybgmflag == '1' ">
      <van-radio-group v-model="dybtype" direction="horizontal" >
        <van-radio name="1">58包</van-radio>
        <van-radio name="2">80包</van-radio>
      </van-radio-group>
    </van-cell>

    <van-field
      v-model="dybgmnum"
      label-width="35%"
      label="打印包购买数量:"
      placeholder="请输入"
      type="number"
      required
      v-if="dybgmflag == '1' "
    />

    <van-field
      v-model="dybgmje"
      label-width="35%"
      label="打印包购买金额:"
      placeholder="请输入"
      type="number"
      required
      v-if="dybgmflag == '1' "
    />

    <van-cell title="是否购买打印纸：" title-style="width:30%;" required v-if="ywlx != '7' ">
      <van-radio-group v-model="dyzgmflag" direction="horizontal" @change="onChangeDyzgmflag">
        <van-radio name="1">是</van-radio>
        <van-radio name="0">否</van-radio>
      </van-radio-group>
    </van-cell>

    <van-cell title="打印纸规格：" title-style="width:30%;" required v-if="dyzggShow == true || dyzgmflag == '1' ">
      <van-radio-group v-model="papertype" direction="horizontal">
        <van-radio name="1">58纸</van-radio>
        <van-radio name="2">80纸</van-radio>
      </van-radio-group>
    </van-cell>

    <van-field
      v-model="dyzgmnum"
      label-width="40%"
      label="打印纸购买数量(箱):"
      placeholder="请输入"
      type="number"
      required
      v-if="dyzgmflag == '1'"
    />

    <van-field
      v-model="dyzgmje"
      label-width="35%"
      label="打印纸购买金额:"
      placeholder="请输入"
      type="number"
      required
      v-if="dyzgmflag == '1'"
    />

    <van-cell  title="选择支付方式" required title-class="titleclass"   v-model="paytypename" center is-link @click="showPaytype" />

    <van-field
      v-model="zje"
      label="实收金额(元):"
      required
      placeholder="请输入实收金额(元)"
      type="number"
    />

    <van-field
      v-model="jfdkje"
      label="积分抵扣金额(元):"
      label-width="35%"
      placeholder="请积分抵扣金额(元)"
      type="number"
    />

    <van-field
      v-model="softcost"
      label="App付款金额(元):"
      label-width="35%"
      required
      placeholder="请输入"
      type="number"
      v-if="result.indexOf('1') >=0"
    />

    <van-field
      v-model="zfbcost"
      label="支付宝金额(元):"
      label-width="35%"
      required
      placeholder="请输入"
      type="number"
      v-if="result.indexOf('2') >=0 "
    />

    <van-field
      v-model="skmcost"
      label="银行收款码金额(元):"
      label-width="40%"
      required
      placeholder="请输入"
      type="number"
      v-if="result.indexOf('3') >=0"
    />

    <van-field
      v-model="yhkcost"
      label="银行卡金额(元):"
      required
      label-width="35%"
      placeholder="请输入"
      type="number"
      v-if="result.indexOf('4') >=0 "
    />

    <van-field
      v-model="wxcost"
      label="微信转账金额(元):"
      required
      label-width="40%"
      placeholder="请输入"
      type="number"
      v-if="result.indexOf('5') >=0 "
    />

    <van-field
      v-model="tbcost"
      label="淘宝金额(元):"
      required
      placeholder="请输入"
      type="number"
      v-if="result.indexOf('6') >=0 "
    />

    <van-field
      v-model="sxfcost"
      label="随行付付款金额(元):"
      required
      placeholder="请输入"
      type="number"
      v-if="result.indexOf('7') >=0 "
    />

    <van-field
      v-model="ysdjje"
      label="预开端口已收金额(元):"
      required
      label-width="42%"
      placeholder="请输入"
      type="number"
    />

    <van-cell title="是否送时长：" title-style="width:30%;" required >
      <van-radio-group v-model="ycscflag" direction="horizontal" @change="onChangeYcsj">
        <van-radio name="1">是</van-radio>
        <van-radio name="0">否</van-radio>
      </van-radio-group>
    </van-cell>

    <van-cell title="是否赠送端口：" title-style="width:30%;" required >
      <van-radio-group v-model="zsdkflag" direction="horizontal" @change="onChangeZsdk">
        <van-radio name="1">是</van-radio>
        <van-radio name="0">否</van-radio>
      </van-radio-group>
    </van-cell>

    <van-cell title="终生是否有服务费：" title-style="width:30%;" required  v-if="(ywlx == '1' && ktlx == '1' && (dklx == '1' || dklx == '2' || dklx == '6' || dklx == '9' || dklx == '10') ) || (ywlx == '1' && ktlx == '2' && (dklx == '1' || dklx == '11' || dklx == '12' || dklx == '21' || dklx == '22' || dklx == '7' || dklx == '9' || dklx == '10' || dklx == '13' || dklx == '14' || dklx == '15' || dklx == '16' || dklx == '17' || dklx == '18'   ) ) ">
      <van-radio-group v-model="fwfflag" direction="horizontal" @change="onChangeFwf">
        <van-radio name="1">是</van-radio>
        <van-radio name="0">否</van-radio>
      </van-radio-group>
    </van-cell>

    <van-field
      v-model="zsdknum"
      label="赠送端口数量:"
      required
      label-width="42%"
      placeholder="请输入"
      type="number"
      v-if="zsdkflag == '1' "
    />

    <van-field
      v-model="bz"
      label="开通说明:"
      required
      label-width="20%"
      placeholder="请输入此账号开通几个业务员账号，开通年限，是否有加时长情况等信息以及其他备注信息"
      type="textarea"
      :autosize="{maxHeight:20,minHeight:5}"

    />

    <div style="background-color: #ffffff;padding-left: 10px;font-size: 16px;">
      <van-uploader v-model="fileList" multiple :max-count="6" :after-read="afterRead" upload-text="附件上传"	:before-delete="onDeleteFile"	/>
    </div>

    <van-field
      v-model="tcje"
      label="提成总金额:"
      placeholder=""
      disabled
      v-if="tcje"
    />
    <van-field
      v-model="dktcje"
      label="端口提成:"
      placeholder=""
      disabled
      v-if="dktcje"
    />
    <van-field
      v-model="dyjtcje"
      label="打印机提成:"
      placeholder=""
      disabled
      v-if="dyjtcje"
    />
    <van-field
      v-model="dyztcje"
      label="打印纸提成:"
      placeholder=""
      disabled
      v-if="dyztcje"
    />

    <van-cell title="是否推荐的客户：" >
      <van-tag  :type="tjbz == '1' ? 'success':'danger'" size="large" >{{tjbz == '1' ? '是':'否'}}</van-tag>
    </van-cell>

    <van-cell title="推荐人："  v-model="tjrname" v-if="tjrname" title-style="width:20%">

    </van-cell>

    <van-steps direction="vertical" :active="active" v-if="ycscflag == '1' || zsdkflag == '1'  ">
      <van-step v-if=" fsflag == '1' || jhflag == '1' ">
        <h3>初审人:{{csrname}}</h3>
        <p>初审时间：{{cssj}}</p>
        <p >初审意见：{{csyj}}</p>
      </van-step>
      <van-step v-if="fsflag == '1' || jhflag == '1' ">
        <h3>复审人：{{fsrname}}</h3>
        <p>复审时间:{{fssj}}</p>
        <p>复审意见:{{fsyj}}</p>
      </van-step>
      <van-step v-if="jhflag == '1' ">
        <h3>终审人:{{jhrname}}</h3>
        <p>激活时间:{{jhtime}}</p>
        <p>终审意见:{{shyj}}</p>
      </van-step>
    </van-steps>

    <van-field
      required
      v-model="shyj"
      label="审核意见:"
      label-width="10%"
      placeholder="请输入审核意见或驳回原因"
      type="textarea"
      :autosize="{maxHeight:20,minHeight:5}"
    />

    <div  class="btn" >

      <div style="width: 33%; display: flex;justify-content: center;" >
        <van-button type="danger" size="normal"  @click="doback" >驳    回</van-button>
      </div>

      <div style="width: 33%; display: flex;justify-content: center;">
        <van-button type="info" size="normal"  @click="doModify" >修改</van-button>
      </div>

      <div style="width: 33%; display: flex;justify-content: center;">
        <van-button type="primary" size="normal"  @click="doSubmit" >审核通过</van-button>
      </div>

    </div>

    <van-action-sheet v-model="show" :actions="actions" @select="onSelectywlx" />

    <van-action-sheet v-model="dklxshow" :actions="dkactions" @select="onSelectDklx" />

    <van-action-sheet v-model="ktlxshow" :actions="ktlxactions" @select="onSelectKtlx" />
    <van-action-sheet v-model="dyjlxshow" :actions="dyjlxactions" @select="onSelectDyjlx" />
    <van-action-sheet v-model="paytypeshow"   cancel-text="确定" @cancel="onSelectPaytype" color="blue">
      <van-checkbox-group v-model="result">
        <van-cell-group>
          <van-cell
            v-for="item in paytypeActions"
            clickable
            :key="item.id"
            :title="item.name"
            @click="toggle(item)"
          >
            <template #right-icon>
              <van-checkbox :name="item.id" ref="checkboxes" />
            </template>
          </van-cell>
        </van-cell-group>
      </van-checkbox-group>

    </van-action-sheet>

  </div>
</template>

<script>

import { Dialog, Toast, Grid, GridItem, Calendar, Cell, Checkbox, CellGroup, CheckboxGroup } from 'vant'

import { addAchievements, examAchievements, uploadShareImg, queryUserInfo, updateAchievements, getAchievements } from '../../api/api'
import { floatAdd } from '../../utils/NumberUtil'
import eventBus from '../../utils/eventbus'
export default {
  name: 'DkktDetail',
  data() {
    return {
      companyListFront: [],
      companyList1: [],
      platformProductCategory: [],
      platformCategory: '',
      productList: [],
      pageNum: 1,
      pageSize: 10,
      date: '',
      show: false,
      kjflag: false,
      showfblx: false,
      showspdl: false,
      ywlxname: '',
      ywlx: '',
      dateshow: false,
      actions: [],
      dkactions: [],
      ktlxactions: [{ id: '1', name: '新开' }, { id: '2', name: '续费' }],
      ktlx: '',
      ktlxname: '',
      dklxname: '',
      dklx: '',
      dklxshow: false,
      minDate: new Date(2021, 1, 1),
      zje: '',
      jfdkje: '',
      ywyname: '',
      currentDate: new Date(),
      achid: '',
      dknum: '',
      ktlxshow: false,
      ktlxxsshow: false,
      dklxxsshow: true,
      dyjlx: '',
      dyjlxactions: [{ id: '1', name: '58打印机' }, { id: '2', name: '80打印机' }],
      dyjlxname: '',
      dyjlxshow: false,
      dyjlxxsshow: false,
      paytypeActions: [],
      paytype: '',
      paytypename: '',
      paytypeshow: false,
      list: ['a', 'b'],
      result: [],
      dyjzsShow: false,
      radio: '',
      dyzggShow: false,
      fileList: [],
      files: '',
      fileUrlArray: [],
      shareas: '',
      shname: '',
      shphone: '',
      znxysnum: '',
      znxysShow: false,
      dyjzsnum: '',
      dybzsnum: '',
      dybzsShow: false,
      papertype: '',
      dybtype: '',
      dybTypeShow: false,
      softcost: '',
      skmcost: '',
      zfbcost: '',
      yhkcost: '',
      tbcost: '',
      wxcost: '',
      sxfcost: '',
      bz: '',
      znxysdyjnum: '',
      znxysdyjShow: false,
      dyjgmflag: '0',
      dybgmflag: '0',
      dyzgmflag: '0',
      userid: '',
      dyjgmnum: '',
      dyjgmje: '',
      dybgmnum: '',
      dybgmje: '',
      dyzgmnum: '',
      dyzgmje: '',
      tcje: '',
      dktcje: '',
      dyjtcje: '',
      dyztcje: '',
      ysdjje: '',
      shyj: '',
      csflag: '',
      fsflag: '',
      jhflag: '',
      ycscflag: '',
      active: 0,
      csrname: '',
      fsrname: '',
      jhrname: '',
      cssj: '',
      fssj: '',
      jhtime: '',
      csyj: '',
      fsyj: '',
      zsdkflag: '0',
      zsdknum: 0,
      dyzzsShow: false,
      dyzzsnum: null,
      tjbz: '',
      tjrname: '',
      fwfflag: '0'
    }
  },

  created() {
    this.queryUserInfo()
    this.ywyname = this.$store.getters.userName
    this.getDicts('sqey_ywlx').then(response => {
      const ywlx = response.data
      const actionArray = []
      if (ywlx) {
        for (var i = 0; i < ywlx.length; i++) {
          const temp = { name: ywlx[i].dictLabel, id: ywlx[i].dictValue }
          actionArray.push(temp)
        }
      }
      this.actions = actionArray
    })

    this.getDicts('sqey_paytype').then(response => {
      const paytypeList = response.data
      const paytypeActions = []
      if (paytypeList) {
        for (var i = 0; i < paytypeList.length; i++) {
          const temp = { name: paytypeList[i].dictLabel, id: paytypeList[i].dictValue }
          paytypeActions.push(temp)
        }
      }
      this.paytypeActions = paytypeActions
    })
    this.date = this.sqeybusiness(new Date())
    const item = this.$route.query.item
    console.log('已填报')
    console.log(item)
    if (item) {
      this.csrname = item.csrname, this.fsrname = item.fsrname
      this.jhrname = item.jhrname,
      this.cssj = item.cssj
      this.fssj = item.fssj
      this.jhtime = item.jhtime
      this.csyj = item.csyj
      this.fsyj = item.fsyj
      this.shyj = item.shyj

      this.tjbz = item.tjbz
      this.tjrname = item.tjrname

      this.fwfflag = item.fwfflag

      this.zsdkflag = item.zsdkflag
      this.zsdknum = item.zsdknum
      this.dyzzsnum = item.dyzzsnum
      this.ycscflag = item.ycscflag
      this.tcje = item.tcje + ''
      this.dktcje = floatAdd(parseFloat(item.tcbdje ? item.tcbdje : 0), parseFloat(item.dktcje ? item.dktcje : 0)) + ''
      this.dyjtcje = item.dyjtcje
      this.dyztcje = item.dyztcje
      this.date = item.ktdate
      this.ywlx = item.ywlx
      this.ywlxname = item.ywlxname
      this.dklx = item.dklx
      this.dklxname = item.dklxname
      this.dknum = item.dknum
      this.zje = item.zje
      this.jfdkje = item.jfdkje
      this.currentDate = new Date(item.ktdate)
      this.achid = item.achid
      this.ktlxname = item.ktlxname
      this.ktlx = item.ktlx
      this.dyjlx = item.dyjlx,
      this.dyjlxname = item.dyjlxname
      if (item.ywlx == '1') {
        this.ktlxxsshow = true
        this.dklxxsshow = true
        this.dyjlxxsshow = false

        if (item.ktlx == '1') {
          if (item.dklx == '1' || item.dklx == '6' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
            this.dyjzsShow = true
            this.dybzsShow = true
          }

          if (item.dklx == '9' || item.dklx == '10') {
            this.dyjzsShow = true
            this.dybzsShow = true
            this.dyzzsShow = true
          }

          if (item.dklx == '11' || item.dklx == '12' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18' || item.dklx == '19' || item.dklx == '20' || item.dklx == '21') {
            this.znxysShow = true
          }

          if (item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
            this.znxysdyjShow = true
          }
        }

        if (item.ktlx == '2') {
          if (item.dklx == '11' || item.dklx == '12' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
            this.dyjzsShow = true
            this.dybzsShow = true
          }

          if (item.dklx == '21' || item.dklx == '22') {
            this.dyjzsShow = true
            this.dybzsShow = true
            this.dyzzsShow = true
          }

          if (item.dklx == '5' || item.dklx == '6' || item.dklx == '7' || item.dklx == '8' || item.dklx == '9' || item.dklx == '10' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
            this.znxysShow = true
          }

          if (item.dklx == '7' || item.dklx == '9' || item.dklx == '10' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
            this.znxysdyjShow = true
          }
        }
      } else if (item.ywlx == '2') {
        this.ktlxxsshow = true
        this.dklxxsshow = true
        this.dyjlxxsshow = false
      } else if (item.ywlx == '3') {
        this.ktlxxsshow = true
        this.dklxxsshow = true
        this.dyjlxxsshow = false
      } else if (item.ywlx == '4') {
        this.ktlxxsshow = true
        this.dklxxsshow = true
        this.dyjlxxsshow = false
      } else if (item.ywlx == '8') {
        this.ktlxxsshow = true
        this.dklxxsshow = true
        this.dyjlxxsshow = false
      } else if (item.ywlx == '5') {
        this.ktlxxsshow = false
        this.dklxxsshow = false
        this.dyjlxxsshow = true
      } else if (item.ywlx == '6') {
        this.dklxxsshow = false
        this.ktlxxsshow = false
        this.dybTypeShow = true
      } else if (item.ywlx == '7') {
        this.ktlxxsshow = false
        this.dklxxsshow = false
        this.dyzggShow = true
      } else {
        this.ktlxxsshow = false
        this.dklxxsshow = false
        this.dyjlxxsshow = false
      }

      if (item.ktlx == '1' && item.ywlx == '1') {
        this.getDicts('sqey_yfx_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
          this.dklx = item.dklx
        })
      }
      if (item.ktlx == '2' && item.ywlx == '1') {
        this.getDicts('sqey_yfx_xflx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
          this.dklx = item.dklx
        })
      }

      if (item.ywlx == '2') {
        this.getDicts('sqey_dgj_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
          this.dklx = item.dklx
        })
      }

      if (item.ywlx == '3') {
        this.getDicts('sqy_pht_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
              if (item.dklx == dklx[i].dictValue) {
                this.dklxname = dklx[i].dictLabel
              }
            }
          }
          this.dkactions = actionArray
        })
      }

      if (item.ywlx == '4') {
        this.getDicts('sqy_zsbi_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
              if (item.dklx == dklx[i].dictValue) {
                this.dklxname = dklx[i].dictLabel
              }
            }
          }
          this.dkactions = actionArray
          this.dklx = item.dklx
        })
      }

      if (item.ywlx == '8') {
        this.getDicts('sqy_hzs_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
              if (item.dklx == dklx[i].dictValue) {
                this.dklxname = dklx[i].dictLabel
              }
            }
          }
          this.dkactions = actionArray
          this.dklx = item.dklx
        })
      }

      this.shareas = item.shareas
      this.shname = item.shname
      this.shphone = item.shphone
      this.znxysnum = item.znxysnum
      this.znxysdyjnum = item.znxysdyjnum
      this.dyjzsnum = item.dyjzsnum
      this.dybzsnum = item.dybzsnum
      this.paytype = item.paytype
      this.dybtype = item.dybtype
      this.papertype = item.papertype
      this.softcost = item.softcost
      this.skmcost = item.skmcost
      this.zfbcost = item.zfbcost
      this.yhkcost = item.yhkcost
      this.tbcost = item.tbcost
      this.wxcost = item.wxcost
      this.sxfcost = item.sxfcost
      this.bz = item.bz
      this.files = item.files
      this.dyjgmnum = item.dyjgmnum
      this.dyjgmje = item.dyjgmje
      this.dybgmnum = item.dybgmnum
      this.dybgmje = item.dybgmje
      this.dyzgmnum = item.dyzgmnum
      this.dyzgmje = item.dyzgmje
      this.dyjgmflag = item.dyjgmflag
      this.dybgmflag = item.dybgmflag
      this.dyzgmflag = item.dyzgmflag
      this.ysdjje = item.ysdjje

      if (this.files) {
        const fileUrlArray = this.files.split(',')
        const fileList = []
        if (fileUrlArray) {
          for (var i = 0; i < fileUrlArray.length; i++) {
            const temp = {
              url: fileUrlArray[i],
              deletable: true
            }
            fileList.push(temp)
          }
        }
        this.fileList = fileList
      }

      this.getDicts('sqey_paytype').then(response => {
        const paytypeList = response.data
        const paytypeActions = []
        if (paytypeList) {
          for (var i = 0; i < paytypeList.length; i++) {
            const temp = { name: paytypeList[i].dictLabel, id: paytypeList[i].dictValue }
            paytypeActions.push(temp)
          }
        }
        const paytype = item.paytype
        let paytypename = ''
        if (paytype) {
          const paytypeArray = paytype.split(',')
          if (paytypeArray) {
            for (var i = 0; i < paytypeArray.length; i++) {
              if (paytypeActions) {
                for (var j = 0; j < paytypeActions.length; j++) {
                  if (paytypeArray[i] == paytypeActions[j].id) {
                    if (paytypename) {
                      paytypename = paytypename + ',' + paytypeActions[j].name
                    } else {
                      paytypename = paytypeActions[j].name
                    }
                  }
                }
              }
            }
          }

          this.result = paytypeArray
          this.paytypename = paytypename
        }
      })
    }

    // window.removeEventListener('scroll',this.onScroll)
  },
  mounted() {

  },

  methods: {

    queryUserInfo() {
      const param = {}
      const that = this
      queryUserInfo(param).then(response => {
        if (response.code === 200) {
          console.log(response)
          this.ywyname = response.data.name
          this.userid = response.data.userid
          const postList = response.data.postList
          if (postList) {
            if (postList.length > 0) {
              for (var i = 0; i < postList.length; i++) {
                console.log(postList[i])
                if (postList[i].postId == 12) {
                  that.csflag = '1'
                }
                if (postList[i].postId == 13) {
                  that.csflag = '1'
                  that.active = 1
                }

                if (postList[i].postId == 11 || postList[i].postId == 1) {
                  that.jhflag = '1'
                  that.active = 2
                }
              }
            }
          }
        } else {
          Toast.fail(response.msg)
        }
      })
    },

    checkPhone(value) {
      if (!(/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(value))) {
        return false
      } else {
        return true
      }
    },

    onChangeYcsj(e) {
      console.log(e)
      this.ycscflag = e
    },

    onChangeZsdk(e) {
      this.zsdkflag = e
      if (e == '0') {
        this.zsdknum = 0
      }
    },

    onChangeFwf(e) {
      this.fwfflag = e
    },

    addyj() {
      this.$router.push({ path: '/addyj', query: {}})
    },

    onDisplay() {
      this.dateshow = true
    },
    onClose() {
      this.show = false
    },

    onConfirm(event) {
      this.dateshow = false
      this.date = this.sqeybusiness(event)
    },

    sqeybusiness(date) {
      const date1 = new Date(date)
      return `${date1.getFullYear()}/${date1.getMonth() + 1}/${date1.getDate()}`
    },

    showFblx() {
      this.show = true
    },

    showDyjlx() {
      this.dyjlxshow = true
    },

    showDklx() {
      if (!this.ywlx) {
        Dialog.alert({
          title: '',
          message: '先选择业务类型'
        })
        return
      }

      if (this.ywlx == '1') {
        if (!this.ktlx) {
          Dialog.alert({
            title: '',
            message: '先选择开通类型'
          })
          return
        }
      }

      this.dklxshow = true
    },

    onSelectDyjlx(item) {
      this.dyjlx = item.id
      this.dyjlxname = item.name
      this.dyjlxshow = false
    },

    getAchievementsInfo(achid) {
      getAchievements(achid).then(response => {
        console.log('修改后业绩', response)
        if (response.code == 200) {
          const item = response.data
          if (item) {
            this.csrname = item.csrname, this.fsrname = item.fsrname,
            this.jhrname = item.jhrname,
            this.cssj = item.cssj,
            this.fssj = item.fssj,
            this.jhtime = item.jhtime,
            this.csyj = item.csyj,
            this.fsyj = item.fsyj,
            this.shyj = item.shyj

            this.ycscflag = item.ycscflag
            this.tcje = item.tcje
            this.dktcje = item.dktcje
            this.dyjtcje = item.dyjtcje
            this.dyztcje = item.dyztcje
            this.date = item.ktdate
            this.ywlx = item.ywlx
            this.ywlxname = item.ywlxname
            this.dklx = item.dklx
            this.dklxname = item.dklxname
            this.dknum = item.dknum
            this.zje = item.zje
            this.jfdkje = item.jfdkje
            this.currentDate = new Date(item.ktdate)
            this.achid = item.achid
            this.ktlxname = item.ktlxname
            this.ktlx = item.ktlx
            this.dyjlx = item.dyjlx,
            this.dyjlxname = item.dyjlxname
            this.dyzzsnum = item.dyzzsnum
            if (item.ywlx == '1') {
              this.ktlxxsshow = true
              this.dklxxsshow = true
              this.dyjlxxsshow = false

              if (item.ktlx == '1') {
                if (item.dklx == '1' || item.dklx == '6') {
                  this.dyjzsShow = true
                  this.dybzsShow = true
                }

                if (item.dklx == '9' || item.dklx == '10') {
                  this.dyjzsShow = true
                  this.dybzsShow = true
                  this.dyzzsShow = true
                }

                if (item.dklx == '11' || item.dklx == '12' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18' || item.dklx == '19' || item.dklx == '20' || item.dklx == '21') {
                  this.znxysShow = true
                }

                if (item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
                  this.znxysdyjShow = true
                }
              }

              if (item.ktlx == '2') {
                if (item.dklx == '11' || item.dklx == '12' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
                  this.dyjzsShow = true
                  this.dybzsShow = true
                }

                if (item.dklx == '21' || item.dklx == '22') {
                  this.dyjzsShow = true
                  this.dybzsShow = true
                  this.dyzzsShow = true
                }

                if (item.dklx == '5' || item.dklx == '6' || item.dklx == '7' || item.dklx == '8' || item.dklx == '9' || item.dklx == '10' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
                  this.znxysShow = true
                }

                if (item.dklx == '7' || item.dklx == '9' || item.dklx == '10' || item.dklx == '13' || item.dklx == '14' || item.dklx == '15' || item.dklx == '16' || item.dklx == '17' || item.dklx == '18') {
                  this.znxysdyjShow = true
                }
              }
            } else if (item.ywlx == '2') {
              this.ktlxxsshow = true
              this.dklxxsshow = true
              this.dyjlxxsshow = false
            } else if (item.ywlx == '3') {
              this.ktlxxsshow = true
              this.dklxxsshow = true
              this.dyjlxxsshow = false
            } else if (item.ywlx == '4') {
              this.ktlxxsshow = true
              this.dklxxsshow = true
              this.dyjlxxsshow = false
            } else if (item.ywlx == '8') {
              this.ktlxxsshow = true
              this.dklxxsshow = true
              this.dyjlxxsshow = false
            } else if (item.ywlx == '5') {
              this.ktlxxsshow = false
              this.dklxxsshow = false
              this.dyjlxxsshow = true
            } else if (item.ywlx == '6') {
              this.dklxxsshow = false
              this.ktlxxsshow = false
              this.dybTypeShow = true
            } else if (item.ywlx == '7') {
              this.ktlxxsshow = false
              this.dklxxsshow = false
              this.dyzggShow = true
            } else {
              this.ktlxxsshow = false
              this.dklxxsshow = false
              this.dyjlxxsshow = false
            }

            if (item.ktlx == '1' && item.ywlx == '1') {
              this.getDicts('sqey_yfx_dklx').then(response => {
                const dklx = response.data
                const actionArray = []
                if (dklx) {
                  for (var i = 0; i < dklx.length; i++) {
                    const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                    actionArray.push(temp)
                  }
                }
                this.dkactions = actionArray
                this.dklx = item.dklx
              })
            }
            if (item.ktlx == '2' && item.ywlx == '1') {
              this.getDicts('sqey_yfx_xflx').then(response => {
                const dklx = response.data
                const actionArray = []
                if (dklx) {
                  for (var i = 0; i < dklx.length; i++) {
                    const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                    actionArray.push(temp)
                  }
                }
                this.dkactions = actionArray
                this.dklx = item.dklx
              })
            }

            if (item.ywlx == '2') {
              this.getDicts('sqey_dgj_dklx').then(response => {
                const dklx = response.data
                const actionArray = []
                if (dklx) {
                  for (var i = 0; i < dklx.length; i++) {
                    const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                    actionArray.push(temp)
                  }
                }
                this.dkactions = actionArray
                this.dklx = item.dklx
              })
            }

            if (item.ywlx == '3') {
              this.getDicts('sqy_pht_dklx').then(response => {
                const dklx = response.data
                const actionArray = []
                if (dklx) {
                  for (var i = 0; i < dklx.length; i++) {
                    const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                    actionArray.push(temp)
                    if (item.dklx == dklx[i].dictValue) {
                      this.dklxname = dklx[i].dictLabel
                    }
                  }
                }
                this.dkactions = actionArray
              })
            }

            if (item.ywlx == '4') {
              this.getDicts('sqy_zsbi_dklx').then(response => {
                const dklx = response.data
                const actionArray = []
                if (dklx) {
                  for (var i = 0; i < dklx.length; i++) {
                    const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                    actionArray.push(temp)
                    if (item.dklx == dklx[i].dictValue) {
                      this.dklxname = dklx[i].dictLabel
                    }
                  }
                }
                this.dkactions = actionArray
                this.dklx = item.dklx
              })
            }

            if (item.ywlx == '8') {
              this.getDicts('sqy_hzs_dklx').then(response => {
                const dklx = response.data
                const actionArray = []
                if (dklx) {
                  for (var i = 0; i < dklx.length; i++) {
                    const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                    actionArray.push(temp)
                    if (item.dklx == dklx[i].dictValue) {
                      this.dklxname = dklx[i].dictLabel
                    }
                  }
                }
                this.dkactions = actionArray
                this.dklx = item.dklx
              })
            }

            this.shareas = item.shareas
            this.shname = item.shname
            this.shphone = item.shphone
            this.znxysnum = item.znxysnum
            this.znxysdyjnum = item.znxysdyjnum
            this.dyjzsnum = item.dyjzsnum
            this.dybzsnum = item.dybzsnum
            this.paytype = item.paytype
            this.dybtype = item.dybtype
            this.papertype = item.papertype
            this.softcost = item.softcost
            this.skmcost = item.skmcost
            this.zfbcost = item.zfbcost
            this.yhkcost = item.yhkcost
            this.tbcost = item.tbcost
            this.wxcost = item.wxcost
            this.sxfcost = item.sxfcost
            this.bz = item.bz
            this.files = item.files
            this.dyjgmnum = item.dyjgmnum
            this.dyjgmje = item.dyjgmje
            this.dybgmnum = item.dybgmnum
            this.dybgmje = item.dybgmje
            this.dyzgmnum = item.dyzgmnum
            this.dyzgmje = item.dyzgmje
            this.dyjgmflag = item.dyjgmflag
            this.dybgmflag = item.dybgmflag
            this.dyzgmflag = item.dyzgmflag
            this.ysdjje = item.ysdjje

            if (this.files) {
              const fileUrlArray = this.files.split(',')
              const fileList = []
              if (fileUrlArray) {
                for (var i = 0; i < fileUrlArray.length; i++) {
                  const temp = {
                    url: fileUrlArray[i],
                    deletable: true
                  }
                  fileList.push(temp)
                }
              }
              this.fileList = fileList
            }

            this.getDicts('sqey_paytype').then(response => {
              const paytypeList = response.data
              const paytypeActions = []
              if (paytypeList) {
                for (var i = 0; i < paytypeList.length; i++) {
                  const temp = { name: paytypeList[i].dictLabel, id: paytypeList[i].dictValue }
                  paytypeActions.push(temp)
                }
              }
              const paytype = item.paytype
              let paytypename = ''
              if (paytype) {
                const paytypeArray = paytype.split(',')
                if (paytypeArray) {
                  for (var i = 0; i < paytypeArray.length; i++) {
                    if (paytypeActions) {
                      for (var j = 0; j < paytypeActions.length; j++) {
                        if (paytypeArray[i] == paytypeActions[j].id) {
                          if (paytypename) {
                            paytypename = paytypename + ',' + paytypeActions[j].name
                          } else {
                            paytypename = paytypeActions[j].name
                          }
                        }
                      }
                    }
                  }
                }

                this.result = paytypeArray
                this.paytypename = paytypename
              }
            })
          }
        }
      })
    },

    onSelectywlx(item) {
      console.log(item)
      this.ywlxname = item.name
      this.ywlx = item.id
      this.show = false
      this.dkactions = []
      this.dklxname = ''
      this.dklx = ''
      this.ktlx = ''
      this.ktlxname = ''

      if (item) {
        if (item.id == '1') {
          this.dklxxsshow = true
          this.ktlxxsshow = true
          this.dyjlxxsshow = false
          this.dyzggShow = false
          this.dybtype = ''
          this.dybTypeShow = false
          this.dyjlx = ''
          this.dyjlxname = ''
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyzgmflag = '0'
          this.dyjgmnum = ''
          this.dybgmnum = ''
          this.dyzgmnum = ''
          this.dyjgmje = ''
          this.dybgmje = ''
          this.dyzgmje = ''
        } else if (item.id == '2') {
          this.dybtype = ''
          this.dybTypeShow = false
          this.znxysShow = false
          this.ktlxxsshow = true
          this.znxysnum = ''
          this.znxysdyjnum = ''
          this.znxysdyjShow = false
          this.getDicts('sqey_dgj_dklx').then(response => {
            const dklx = response.data
            const actionArray = []
            if (dklx) {
              for (var i = 0; i < dklx.length; i++) {
                const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                actionArray.push(temp)
              }
            }
            this.dkactions = actionArray
          })
          this.dklxxsshow = true
          this.dyzggShow = false
          this.dyjzsShow = false
          this.dybzsShow = false
          this.dyzzsShow = false
          this.dyzzsnum = ''
          this.dyjzsnum = ''
          this.dybzsnum = ''
          this.ktlx = ''
          this.ktlxname = ''
          this.dyjlxxsshow = false
          this.dyjlx = ''
          this.dyjlxname = ''
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyzgmflag = '0'
          this.dyjgmnum = ''
          this.dybgmnum = ''
          this.dyzgmnum = ''
          this.dyjgmje = ''
          this.dybgmje = ''
          this.dyzgmje = ''
        } else if (item.id == '3') {
          this.dybtype = ''
          this.dybTypeShow = false
          this.znxysShow = false
          this.ktlxxsshow = true
          this.znxysnum = ''
          this.znxysdyjnum = ''
          this.znxysdyjShow = false
          this.getDicts('sqy_pht_dklx').then(response => {
            const dklx = response.data
            const actionArray = []
            if (dklx) {
              for (var i = 0; i < dklx.length; i++) {
                const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                actionArray.push(temp)
              }
            }
            this.dkactions = actionArray
          })
          this.dklxxsshow = true
          this.dyzggShow = false
          this.dyjzsShow = false
          this.dybzsShow = false
          this.dyzzsShow = false
          this.dyzzsnum = ''
          this.dyjzsnum = ''
          this.dybzsnum = ''
          this.ktlx = ''
          this.ktlxname = ''
          this.dyjlxxsshow = false
          this.dyjlx = ''
          this.dyjlxname = ''
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyzgmflag = '0'
          this.dyjgmnum = ''
          this.dybgmnum = ''
          this.dyzgmnum = ''
          this.dyjgmje = ''
          this.dybgmje = ''
          this.dyzgmje = ''
        } else if (item.id == '4') {
          this.dybtype = ''
          this.dybTypeShow = false
          this.znxysShow = false
          this.ktlxxsshow = true
          this.znxysnum = ''
          this.znxysdyjnum = ''
          this.znxysdyjShow = false
          this.getDicts('sqy_zsbi_dklx').then(response => {
            const dklx = response.data
            const actionArray = []
            if (dklx) {
              for (var i = 0; i < dklx.length; i++) {
                const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                actionArray.push(temp)
              }
            }
            this.dkactions = actionArray
          })
          this.dklxxsshow = true
          this.dyzggShow = false
          this.dyjzsShow = false
          this.dybzsShow = false
          this.dyzzsShow = false
          this.dyzzsnum = ''
          this.dyjzsnum = ''
          this.dybzsnum = ''
          this.ktlx = ''
          this.ktlxname = ''
          this.dyjlxxsshow = false
          this.dyjlx = ''
          this.dyjlxname = ''
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyzgmflag = '0'
          this.dyjgmnum = ''
          this.dybgmnum = ''
          this.dyzgmnum = ''
          this.dyjgmje = ''
          this.dybgmje = ''
          this.dyzgmje = ''
        } else if (item.id == '8') {
          this.dybtype = ''
          this.dybTypeShow = false
          this.znxysShow = false
          this.znxysnum = ''
          this.znxysdyjnum = ''
          this.znxysdyjShow = false
          this.getDicts('sqy_hzs_dklx').then(response => {
            const dklx = response.data
            const actionArray = []
            if (dklx) {
              for (var i = 0; i < dklx.length; i++) {
                const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
                actionArray.push(temp)
              }
            }
            this.dkactions = actionArray
          })
          this.dklxxsshow = true
          this.ktlxxsshow = true
          this.dyzggShow = false
          this.dyjzsShow = false
          this.dybzsShow = false
          this.dyzzsShow = false
          this.dyzzsnum = ''
          this.dyjzsnum = ''
          this.dybzsnum = ''
          this.ktlx = ''
          this.ktlxname = ''
          this.dyjlxxsshow = false
          this.dyjlx = ''
          this.dyjlxname = ''
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyzgmflag = '0'
          this.dyjgmnum = ''
          this.dybgmnum = ''
          this.dyzgmnum = ''
          this.dyjgmje = ''
          this.dybgmje = ''
          this.dyzgmje = ''
        } else if (item.id == '5') {
          this.dybtype = ''
          this.dybTypeShow = false
          this.znxysShow = false
          this.znxysnum = ''
          this.znxysdyjShow = false
          this.znxysdyjnum = ''
          this.dyjlxxsshow = true
          this.ktlxxsshow = false
          this.dyzggShow = false
          this.dklxxsshow = false
          this.dyjzsShow = false
          this.dybzsShow = false
          this.dyzzsShow = false
          this.dyzzsnum = ''
          this.dyjzsnum = ''
          this.dybzsnum = ''
          this.dklx = ''
          this.dklxname = ''
          this.ktlx = ''
          this.ktlxname = ''
          this.dyjgmnum = ''
          this.dyjgmje = ''
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyzgmflag = '0'
          this.dybgmnum = ''
          this.dyzgmnum = ''
          this.dybgmje = ''
          this.dyzgmje = ''
        } else if (item.id == '7') {
          this.dybtype = ''
          this.dybTypeShow = false
          this.znxysShow = false
          this.znxysnum = ''
          this.znxysdyjShow = false
          this.znxysdyjnum = ''
          this.dyzggShow = true
          this.dyjzsShow = false
          this.dybzsShow = false
          this.dyzzsShow = false
          this.dyzzsnum = ''
          this.dyjzsnum = ''
          this.dybzsnum = ''
          this.dyjlxxsshow = false
          this.ktlxxsshow = false
          this.dyjlx = ''
          this.dyjlxname = ''
          this.dklxxsshow = false
          this.dklx = ''
          this.dklxname = ''
          this.ktlx = ''
          this.ktlxname = ''
          this.dyzgmnum = ''
          this.dyzgmje = ''
          this.dyzgmflag = '0'
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyjgmnum = ''
          this.dybgmnum = ''
          this.dyjgmje = ''
          this.dybgmje = ''
        } else if (item.id == '6') {
          this.dybTypeShow = true
          this.znxysShow = false
          this.znxysnum = ''
          this.znxysdyjShow = false
          this.znxysdyjnum = ''
          this.dyzggShow = false
          this.papertype = ''
          this.dyjzsShow = false
          this.dybzsShow = false
          this.dyzzsShow = false
          this.dyzzsnum = ''
          this.dyjzsnum = ''
          this.dybzsnum = ''
          this.dyjlxxsshow = false
          this.ktlxxsshow = false
          this.dyjlx = ''
          this.dyjlxname = ''
          this.dklxxsshow = false
          this.dklx = ''
          this.dklxname = ''
          this.ktlx = ''
          this.ktlxname = ''
          this.dybgmnum = ''
          this.dybgmje = ''
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyzgmflag = '0'
          this.dyjgmnum = ''
          this.dyzgmnum = ''
          this.dyjgmje = ''
          this.dyzgmje = ''
        } else {
          this.znxysShow = false
          this.znxysnum = ''
          this.znxysdyjShow = false
          this.znxysdyjnum = ''
          const actions = [{ name: '无', id: '1' }]
          this.dkactions = actions
          this.ktlxxsshow = false
          this.dklxxsshow = false
          this.dklx = ''
          this.dklxname = ''
          this.ktlx = ''
          this.ktlxname = ''
          this.dyjlxxsshow = false
          this.dyjlx = ''
          this.dyjlxname = ''
          this.dyzggShow = false
          this.dyjzsShow = false
          this.dybzsShow = false
          this.dyzzsShow = false
          this.dyzzsnum = ''
          this.dyjzsnum = ''
          this.dybzsnum = ''
          this.dyjgmflag = '0'
          this.dybgmflag = '0'
          this.dyzgmflag = '0'
          this.dyjgmnum = ''
          this.dybgmnum = ''
          this.dyzgmnum = ''
          this.dyjgmje = ''
          this.dybgmje = ''
          this.dyzgmje = ''
        }
      }
    },

    onSelectPaytype() {
      console.log(this.result)
      let paytypename = ''
      let paytype = ''
      const result = this.result
      const paytypeActions = this.paytypeActions
      if (result) {
        for (var i = 0; i < result.length; i++) {
          if (paytypeActions) {
            for (var j = 0; j < paytypeActions.length; j++) {
              if (result[i] == paytypeActions[j].id) {
                if (paytypename) {
                  paytypename = paytypename + ',' + paytypeActions[j].name
                } else {
                  paytypename = paytypeActions[j].name
                }
                if (paytype) {
                  paytype = paytype + ',' + paytypeActions[j].id
                } else {
                  paytype = paytypeActions[j].id
                }
              }
            }
          }
        }
      }

      if (paytype) {
        const payArray = paytype.split(',')
        if (payArray.indexOf('1') < 0) {
          this.softcost = '0'
        }

        if (payArray.indexOf('2') < 0) {
          this.zfbcost = '0'
        }
        if (payArray.indexOf('3') < 0) {
          this.skmcost = '0'
        }
        if (payArray.indexOf('4') < 0) {
          this.yhkcost = '0'
        }
        if (payArray.indexOf('5') < 0) {
          this.wxcost = '0'
        }
        if (payArray.indexOf('6') < 0) {
          this.tbcost = '0'
        }
        if (payArray.indexOf('7') < 0) {
          this.sxfcost = '0'
        }
      }
      this.paytypeshow = false
      this.paytypename = paytypename
      this.paytype = paytype
    },

    onSelectDklx(item) {
      this.dklxname = item.name
      this.dklx = item.id
      this.dklxshow = false
      if (this.ywlx == '1' && this.ktlx == '1' && (item.id == '1' || item.id == '6' || item.id == '13' || item.id == '14' || item.id == '15' || item.id == '16' || item.id == '17' || item.id == '18')) {
        this.dyjzsShow = true
        this.dybzsShow = true
      } else if (this.ywlx == '1' && this.ktlx == '2' && (item.id == '11' || item.id == '12' || item.id == '13' || item.id == '14' || item.id == '15' || item.id == '16' || item.id == '17' || item.id == '18')) {
        this.dyjzsShow = true
        this.dybzsShow = true
      } else if (this.ywlx == '1' && this.ktlx == '1' && (item.id == '9' || item.id == '10')) {
        this.dyjzsShow = true
        this.dybzsShow = true
        this.dyzzsShow = true
      } else if (this.ywlx == '1' && this.ktlx == '2' && (item.id == '21' || item.id == '22')) {
        this.dyjzsShow = true
        this.dybzsShow = true
        this.dyzzsShow = true
      } else {
        this.dyjzsShow = false
        this.dyjzsnum = ''
        this.dybzsShow = false
        this.dybzsnum = ''
        this.dyzzsShow = false
        this.dyzzsnum = ''
      }

      if (this.ktlx == '1' && (item.id == '11' || item.id == '12' || item.id == '13' || item.id == '14' || item.id == '15' || item.id == '16' || item.id == '17' || item.id == '18' || item.id == '19' || item.id == '20' || item.id == '21')) {
        this.znxysShow = true
      } else if (this.ktlx == '2' && (item.id == '5' || item.id == '6' || item.id == '7' || item.id == '8' || item.id == '9' || item.id == '10' || item.id == '13' || item.id == '14' || item.id == '15' || item.id == '16' || item.id == '17' || item.id == '18')) {
        this.znxysShow = true
      } else {
        this.znxysShow = false
        this.znxysnum = ''
      }

      if (this.ktlx == '1' && (item.id == '13' || item.id == '14' || item.id == '15' || item.id == '16' || item.id == '17' || item.id == '18')) {
        this.znxysdyjShow = true
      } else if (this.ktlx == '2' && (item.id == '7' || item.id == '9' || item.id == '10' || item.id == '13' || item.id == '14' || item.id == '15' || item.id == '16' || item.id == '17' || item.id == '18')) {
        this.znxysdyjShow = true
      } else {
        this.znxysdyjShow = false
        this.znxysdyjnum = ''
      }
    },

    onSelectKtlx(item) {
      this.ktlxname = item.name
      this.ktlx = item.id
      this.dklx = ''
      this.dklxname = ''

      if (item.id == '1' && this.ywlx == '1') {
        this.getDicts('sqey_yfx_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
        })

        this.znxysShow = false
        this.znxysnum = ''
        this.znxysdyjShow = false
        this.znxysdyjnum = ''
      }

      if (item.id == '2' && this.ywlx == '1') {
        this.getDicts('sqey_yfx_xflx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
        })
      }

      if (this.ywlx == '2') {
        this.getDicts('sqey_dgj_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
        })
      }

      if (this.ywlx == '3') {
        this.getDicts('sqy_pht_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
        })
      }

      if (this.ywlx == '4') {
        this.getDicts('sqy_zsbi_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
        })
      }

      if (this.ywlx == '8') {
        this.getDicts('sqy_hzs_dklx').then(response => {
          const dklx = response.data
          const actionArray = []
          if (dklx) {
            for (var i = 0; i < dklx.length; i++) {
              const temp = { name: dklx[i].dictLabel, id: dklx[i].dictValue }
              actionArray.push(temp)
            }
          }
          this.dkactions = actionArray
        })
      }

      this.ktlxshow = false
    },

    doModify() {
      const fileList = this.fileList
      const fileList1 = []
      if (fileList) {
        for (var i = 0; i < fileList.length; i++) {
          fileList1.push(fileList[i].file)
        }
      }

      if (!this.date) {
        Toast.fail('请选择缴费日期')
        return
      }

      if (!this.shareas) {
        Toast.fail('请填写商户区域')
        return
      }

      if (!this.shname) {
        Toast.fail('请填写商户名称')
        return
      }

      if (!this.shphone) {
        Toast.fail('请填写商户电话')
        return
      } else {
        if (!this.checkPhone(this.shphone)) {
          Toast.fail('商户手机号格式不正确')
          return
        }
      }

      if (!this.ywlx) {
        Toast.fail('请选择业务类型')
        return
      }

      if (this.ywlx == '1') {
        if (!this.ktlx) {
          Toast.fail('请选择开通类型')
          return
        }
        if (this.ktlx == '1' && (this.dklx == '1' || this.dklx == '6')) {
          if (!this.dyjzsnum) {
            Toast.fail('请输入打印机赠送数量')
            return
          }
          if (!this.dybzsnum) {
            Toast.fail('请输入打印包赠送数量')
            return
          }
        }

        if (this.ktlx == '2' && (this.dklx == '11' || this.dklx == '12')) {
          if (!this.dyjzsnum) {
            Toast.fail('请输入打印机赠送数量')
            return
          }
          if (!this.dybzsnum) {
            Toast.fail('请输入打印包赠送数量')
            return
          }
        }

        if (this.ktlx == '2' && (this.dklx == '5' || this.dklx == '6' || this.dklx == '7' || this.dklx == '8' || this.dklx == '9' || this.dklx == '10')) {
          if (!this.znxysnum) {
            Toast.fail('请输入转年限已收端口金额')
            return
          }
        }

        if (this.ktlx == '2' && (this.dklx == '7' || this.dklx == '9' || this.dklx == '10')) {
          if (!this.znxysdyjnum) {
            Toast.fail('请输入转年限已收打印机金额')
            return
          }
        }
      }

      if (this.ywlx == '2') {
        if (!this.dklx) {
          Toast.fail('请选择端口类型')
          return
        }
      }

      if (this.ywlx == '5') {
        if (!this.dyjlx) {
          Toast.fail('请选择打印机类型')
          return
        }
      }

      if (this.dyjgmflag == '1') {
        if (!this.dyjgmnum) {
          Toast.fail('请输入打印机购买数量')
          return
        }
        if (!this.dyjgmje) {
          Toast.fail('请输入打印机购买金额')
          return
        }
      }

      if (this.dybgmflag == '1') {
        if (!this.dybgmnum) {
          Toast.fail('请输入打印包购买数量')
          return
        }
        if (!this.dybgmje) {
          Toast.fail('请输入打印包购买金额')
          return
        }
      }

      if (this.dyzgmflag == '1') {
        if (!this.dyzgmnum) {
          Toast.fail('请输入打印纸购买数量')
          return
        }
        if (!this.dyzgmje) {
          Toast.fail('请输入打印纸购买金额')
          return
        }
      }

      if (this.ywlx == '6') {
        if (!this.dybtype) {
          Toast.fail('请选择打印包类型')
          return
        }
      }

      if (this.ywlx == '7') {
        if (!this.papertype) {
          Toast.fail('请选择打印纸类型')
          return
        }
      }

      if (!this.zje) {
        Toast.fail('请填写总金额')
        return
      }

      if (!this.dknum) {
        Toast.fail('请填写数量')
        return
      }

      if (!this.ysdjje) {
        Toast.fail('请填写预开端口已收金额')
        return
      }

      if (this.zsdkflag == '1') {
        if (this.zsdknum == 0) {
          Toast.fail('选择赠送端口，赠送数量必须大于0')
          return
        }
      }

      if (!this.paytype) {
        Toast.fail('请选择支付方式')
        return
      } else {
        const payArray = this.paytype.split(',')
        if (payArray.indexOf('1') >= 0) {
          if (!this.softcost) {
            Toast.fail('App缴费金额未填写')
            return
          }
        }
        if (payArray.indexOf('2') >= 0) {
          if (!this.zfbcost) {
            Toast.fail('支付宝缴费金额未填写')
            return
          }
        }
        if (payArray.indexOf('3') >= 0) {
          if (!this.skmcost) {
            Toast.fail('银行卡收款码缴费金额未填写')
            return
          }
        }
        if (payArray.indexOf('4') >= 0) {
          if (!this.yhkcost) {
            Toast.fail('银行卡缴费金额未填写')
            return
          }
        }
        if (payArray.indexOf('5') >= 0) {
          if (!this.wxcost) {
            Toast.fail('微信转账金额未填写')
            return
          }
        }
        if (payArray.indexOf('6') >= 0) {
          if (!this.tbcost) {
            Toast.fail('淘宝金额未填写')
            return
          }
        }

        if (payArray.indexOf('7') >= 0) {
          if (!this.sxfcost) {
            Toast.fail('随行付付款金额未填写')
            return
          }
        }
      }

      const achid = this.achid

      if (achid) {
        const param = { ktdate: this.date, ywlx: this.ywlx, dklx: this.dklx, zje: this.zje, achid: this.achid, dknum: this.dknum, ktlx: this.ktlx, dyjlx: this.dyjlx, files: this.files }
        param.shareas = this.shareas
        param.shname = this.shname
        param.shphone = this.shphone
        param.znxysnum = this.znxysnum
        param.znxysdyjnum = this.znxysdyjnum
        param.dyjzsnum = this.dyjzsnum
        param.dybzsnum = this.dybzsnum
        param.paytype = this.paytype
        param.dybtype = this.dybtype
        param.papertype = this.papertype
        param.softcost = this.softcost
        param.skmcost = this.skmcost
        param.zfbcost = this.zfbcost
        param.yhkcost = this.yhkcost
        param.tbcost = this.tbcost
        param.wxcost = this.wxcost
        param.sxfcost = this.sxfcost
        param.bz = this.bz
        param.dyjgmnum = this.dyjgmnum
        param.dyjgmje = this.dyjgmje
        param.dybgmnum = this.dybgmnum
        param.dybgmje = this.dybgmje
        param.dyzgmnum = this.dyzgmnum
        param.dyzgmje = this.dyzgmje
        param.dyjgmflag = this.dyjgmflag
        param.dybgmflag = this.dybgmflag
        param.dyzgmflag = this.dyzgmflag
        param.ysdjje = this.ysdjje
        param.userId = this.userid
        param.ycscflag = this.ycscflag
        param.zsdkflag = this.zsdkflag
        param.zsdknum = this.zsdknum
        param.dyzzsnum = this.dyzzsnum
        param.fwfflag = this.fwfflag
        param.jfdkje = this.jfdkje
        console.log('入参：', param)
        updateAchievements(param).then(response => {
          if (response.code === 200) {
            if (response.data == '1') {
              Dialog.confirm({
                title: '',
                message: '修改成功'
              })
                .then(() => {
                  this.getAchievementsInfo(achid)
                })
                .catch(() => {
                  // on cancel
                })
            }
          } else {
            Toast.fail(response.msg)
          }
        })
      }
    },

    doSubmit() {
      const param = { achid: this.achid }
      if (this.csflag == '1') {
        param.csflag = '1'
        param.csyj = this.shyj
      }

      if (this.jhflag == '1') {
        param.jhflag = '1'
        param.shyj = this.shyj
      }

      param.tjbz = this.tjbz
      param.zje = this.zje
      param.jfdkje = this.jfdkje
      param.dktcje = this.dktcje ? this.dktcje : 0
      param.tcje = this.tcje ? this.tcje : 0
      param.ywlx = this.ywlx
      param.ktlx = this.ktlx
      param.dyjgmje = this.dyjgmje ? this.dyjgmje : 0
      param.dybgmje = this.dybgmje ? this.dybgmje : 0
      param.dyzgmje = this.dyzgmje ? this.dyzgmje : 0
      param.tjrname = this.tjrname
      param.dklx = this.dklx
      param.dknum = this.dknum
      console.log(param)

      examAchievements(param).then(response => {
        if (response.code === 200) {
          if (response.data == '1') {
            Toast.success('已审核')
            // eventBus.$emit('dkktDetail',{});
            this.$router.go(-1) // 返回上一层
          }
        } else {
          Toast.fail(response.msg)
        }
      })
    },

    showKtlx() {
      this.ktlxshow = true
    },

    doback() {
      const param = { achid: this.achid }
      if (this.csflag == '1') {
        param.csflag = '2'
        param.csyj = this.shyj

        if (!this.shyj) {
          Toast.fail('请输入审核意见')
          return
        }
      }

      if (this.jhflag == '1') {
        param.jhflag = '2'
        param.shyj = this.shyj
        if (!this.shyj) {
          Toast.fail('请输入审核意见')
          return
        }
      }

      examAchievements(param).then(response => {
        if (response.code === 200) {
          if (response.data == '1') {
            Toast.success('已驳回')
            this.$router.go(-1) // 返回上一层
          }
        } else {
          Toast.fail(response.msg)
        }
      })
    },

    goback() {
      this.$router.go(-1) // 返回上一层
    },

    showPaytype() {
      // this.result = []
      this.paytypeshow = true
    },

    toggle(item) {
      var index = parseInt(item.id) - 1
      this.$refs.checkboxes[index].toggle()
    },
    // 文件读取后上传至服务器
    afterRead(file) {
      console.log(file)
      const file1 = file.file
      if (file1) {
        var fileSize = 0
        if (file1.size > 1024 * 1024) { fileSize = (Math.round(file1.size * 100 / (1024 * 1024)) / 100).toString() + 'MB' } else { fileSize = (Math.round(file1.size * 100 / 1024) / 100).toString() + 'KB' }

        console.log(file1.name)
        console.log(fileSize)
        console.log(file1.type)

        const formData = new FormData()
        formData.append('file', file1)
        formData.append('type', 'quanzi')
        uploadShareImg(formData).then(response => {
          console.log(response)
          if (response.code == 200) {
            if (response.data) {
              this.fileUrlArray.push(response.data.url)
              console.log(this.fileUrlArray.toString())
              this.files = this.fileUrlArray.toString()
            }
          }
        })
      }
    },

    onBeforeRead(file) {
      console.log(file)
    },

    // 删除文件
    onDeleteFile(file) {
      console.log(file)
      const files = this.files
      if (files) {
        const fileUrlArray = files.split(',')
        const i = fileUrlArray.indexOf(file.url)
        fileUrlArray.splice(i, 1)
        this.files = fileUrlArray.toString()
      }

      const fileList = this.fileList
      if (fileList) {
        const j = fileList.indexOf(file)
        fileList.splice(j, 1)
        this.fileList = fileList
      }
    },

    onChangeDyjgmflag(e) {
      if (e == '0') {
        this.dyjgmnum = ''
        this.dyjgmje = ''
        this.dyjlx = ''
      }
    },

    onChangeDybgmflag(e) {
      if (e == '0') {
        this.dybgmnum = ''
        this.dybgmje = ''
        this.dybtype = ''
      }
    },

    onChangeDyzgmflag(e) {
      if (e == '0') {
        this.dyzgmnum = ''
        this.dyzgmje = ''
        this.papertype = ''
      }
    }

  }
}
</script>
<style lang="scss" scoped>

  .container{
    width: 100%;
    height: calc(100vh);
    background-color: white;
  }

  .navclass{
    background-color:#f8f8f8;
  }

  .btn{
    width: 100%;
    display: flex;
    flex-direction: row;
    padding-top: 30px;
    background-color: white;
    padding-bottom: 150px;
  }

  .labelcss{
    color: red;
  }

</style>
